package com.app.common.vo;

import java.io.Serializable;
import java.util.HashMap;

public class AjaxResultData  extends HashMap<String, Object> implements Serializable{

    private static final long serialVersionUID = 1L;


    /** 状态码 */
    public static final String CODE_TAG = "code";

    /** 返回内容 */
    public static final String MSG_TAG = "msg";

    /** 数据对象 */
    public static final String DATA_TAG = "data";


    public AjaxResultData() {}

    public AjaxResultData(int code, String msg, Object data) {
        super.put(CODE_TAG,code);
        super.put(MSG_TAG,msg);
        super.put(DATA_TAG,data);
    }

    public static AjaxResultData succ(String msg) {
        return new AjaxResultData(ResultType.SUCCESS.value(), msg, null);
    }

    public static AjaxResultData succ(String msg ,Object data) {
        return new AjaxResultData(ResultType.SUCCESS.value(), msg, data);
    }


    public static AjaxResultData err(String msg) {
        return new AjaxResultData(ResultType.ERROR.value(), msg, null);
    }

    public static AjaxResultData err(String msg ,Object data) {
        return new AjaxResultData(ResultType.ERROR.value(), msg, data);
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    @Override
    public AjaxResultData put(String key, Object value) {
        super.put(key, value);
        return this;
    }


}
